package com.zxy.hotel.controller;


import com.zxy.hotel.entity.RS;
import com.zxy.hotel.entity.Type;
import com.zxy.hotel.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jiusi
 * @since 2021-12-12
 */
@RestController
@RequestMapping("/type")
@PreAuthorize("hasAnyRole('admin','root','staff')")
public class TypeController {

    @Autowired
    private TypeService typeService;

    @GetMapping
    public RS list(){
        List<Type> list = typeService.list();
        return RS.ok().data(list);
    }
}
